package com.seo.controller.transaction;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.seo.pojo.ReturnBody;
import com.seo.service.deduc.impl.DeducServiceImpl;
import com.seo.service.user.recharge.sdk.RechargeService;
import com.seo.utils.CommonUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName: DeducController
 * @author sbl
 * @version 2018.07.28 12:20
 */
@Slf4j
@Controller
@RequestMapping(value = "/deduc/")
public class DeducController {

	@Autowired
	private DeducServiceImpl deducService;


	@RequestMapping(value = "/add")
	public String add() {
		log.info("添加扣费界面");
		return "bill/deduc_add";
	}

	@RequestMapping("/addDeduc")
	@ResponseBody
	public ReturnBody addDeduc(@RequestParam Map<String, Object> params, HttpServletRequest request) {

		String tradeId = CommonUtil.getUUID();
		log.info("[{}]-保存扣费明细", tradeId);

		return deducService.saveDeducDetail(tradeId, params);
	}

}
